package com.iwdnb.gkgz.job;

import com.iwdnb.gkgz.application.service.RealtimeStockService;
import com.iwdnb.job.annotation.Job;
import com.iwdnb.job.handler.BaseJobHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import static com.iwdnb.gkgz.common.utils.WorkTimeUtils.isWorkingTime;

/**
 * 股票同步实时股票信息
 */
@Slf4j
@Job(cron = "0 * 9,10,11,13,14,15 * * ?")
public class StockSyncRealtimeDataJob extends BaseJobHandler {

    @Autowired
    private RealtimeStockService realtimeStockService;

    @Override
    public boolean doProcess(String parameter) {
        if (!isWorkingTime()) {
            return true;
        }
        log.info("StockSyncRealtimeDataJob start");
        realtimeStockService.syncRealtimeData(null);
        log.info("StockSyncRealtimeDataJob finished");
        return true;
    }
}
